package cn.cvs.controller;

import cn.cvs.entity.Auctionrecord;
import cn.cvs.service.AuctionrecordService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import java.util.Date;

@Controller
public class AuctionrecordController {
    @Resource
    private AuctionrecordService auctionrecordService;

    @RequestMapping("/SaddRecord")
    public String addRecord(Auctionrecord auctionrecord){
        auctionrecord.setAuctionTime(new Date());
        System.out.println(auctionrecord.toString());
        System.out.println(auctionrecordService.addRecord(auctionrecord)>0?"添加成功":"添加失败");
        return "redirect:/SauctionDetail?id="+auctionrecord.getAuctionId();
    }

}
